<?php
/**
 * Created by PhpStorm.
 * UsersF: Mloong
 * Date: 2018/12/12
 * Time: 11:00
 */

namespace app\admin\model;


class Category extends BaseModel
{
    /**
     * @param $category_id 分类id
     * @return bool
     * @throws \Exception
     */
    public static function delOne($category_id)
    {
        return self::where('category_id','=',$category_id)
            ->delete();
    }

    /**
     * 根据id查找一条数据
     */
    public static function findOne($category_id)
    {
        return self::where('category_id','=',$category_id)
            ->find();
    }
    public static function getAllCategoryName()
    {
        return self::where('status','=','1')
            ->visible(['category_name','category_id'])
            ->select()
            ->toArray();
    }
}